﻿namespace LambdaCalc.Spike

open System
open Booleans

module Main = 

    [<EntryPoint>]
    let main argv = 

        let r = True .> Not
        printfn "Not True: %s" (r.ToString())

        let r = False .> Not
        printfn "Not False: %s" (r.ToString())

        printfn "True || True = %s" ((Or <. True <. True).ToString())
        printfn "True || False = %s" ((Or <. True <. False).ToString())
        printfn "False || True = %s" ((Or <. False <. True).ToString())
        printfn "False || False = %s" ((Or <. False <. False).ToString())

        let pair = Term.Parse(@"\first.\second.\func.((func first) second)")
        let test = pair <. Id "Hallo" <. Id "5"

        let first = Term.Parse(@"\first.\second.first")
        let second = Term.Parse(@"\first.\second.second")

        let zero = Term.Parse(@"\s.\z.z")
        let S = Term.Parse(@"\w.\s.\z.(s ((w s) z))")
        let one = S <. zero
        let two = S <. one
        let three = S <. two

        let add = Term.Parse(@"\n.\m.\f.\x.((n f) ((m f) x))")

        let three' = (add <. one) <. two

        printfn "first: %s" ((first .> test).ToString())
        printfn "second: %s" ((second .> test).ToString())

        printfn "S: %s" (S.ToString())
        printfn "Zero: %s" (zero.ToString())
        printfn "One: %s" (one.ToString())
        printfn "Three: %s / %s" (three.ToString()) ((normalAlphaRename three).ToString())
        printfn "Three': %s / %s" (three'.ToString()) ((normalAlphaRename three').ToString())
        printfn "3 = Three'? %A" (equals three three')
        0 // return an integer exit code
